package com.yyfax.pay.third.model.to.fuiou;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.io.xml.QNameMap;
import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.yyfax.framework.model.Content;

/**
 * 订单结果查询接口（商户订单号）返回数据封装类
 * 
 * @author heizq
 * @date 2017-04-11 20:02:09
 * @since v1.0.0
 */
@SuppressWarnings("serial")
@XStreamAlias("RESPONSE")
public class QueryOrderByOrderNumFuiouContent extends Content {

	/**
	 * 版本号
	 */
	@XStreamAlias("VERSION")
	private String version;

	/**
	 * 响应代码 0000成功
	 */
	@XStreamAlias("RESPONSECODE")
	private String responseCode;

	/**
	 * 响应中文描述
	 */
	@XStreamAlias("RESPONSEMSG")
	private String responseMsg;

	/**
	 * 商户流水号
	 */
	@XStreamAlias("MCHNTORDERID")
	private String mchntOrderId;

	/**
	 * MD5摘要数据 VERSION+"|"+RESPONSECODE+"|"+ RESPONSEMSG+"|"+MCHNTORDERID+"|"+商户32位密钥key"
	 */
	@XStreamAlias("SIGN")
	private String sign;

	/**
	 * 响应报文
	 */
	private String rspContent;

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getResponseCode() {
		return responseCode;
	}

	public void setResponseCode(String responseCode) {
		this.responseCode = responseCode;
	}

	public String getResponseMsg() {
		return responseMsg;
	}

	public void setResponseMsg(String responseMsg) {
		this.responseMsg = responseMsg;
	}

	public String getMchntOrderId() {
		return mchntOrderId;
	}

	public void setMchntOrderId(String mchntOrderId) {
		this.mchntOrderId = mchntOrderId;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getRspContent() {
		return rspContent;
	}

	public void setRspContent(String rspContent) {
		this.rspContent = rspContent;
	}

	/**
	 * 该实体转换成XML字符串
	 * 
	 * @author heizq
	 * @date 2017-4-12 10:52:52
	 * @since v1.0.0
	 * @return 返回XML字符串
	 */
	public String toXml() {
		QNameMap qmap = new QNameMap();
		qmap.setDefaultNamespace("http://www.99bill.com/mas_cnp_merchant_interface");
		qmap.setDefaultPrefix("");
		StaxDriver staxDriver = new StaxDriver(qmap);
		XStream xstream = new XStream(staxDriver);
		xstream.autodetectAnnotations(true);
		xstream.ignoreUnknownElements();
		xstream.alias("RESPONSE", QueryOrderByOrderNumFuiouContent.class);
		return xstream.toXML(this);
	}

	/**
	 * XML字符串转换成实体{@link QueryOrderByOrderNumFuiouContent}
	 * 
	 * @author heizq
	 * @date 2017-4-12 10:53:28
	 * @since v1.0.0
	 * @param xml
	 * @return 返回{@link QueryOrderByOrderNumFuiouContent}
	 */
	public static QueryOrderByOrderNumFuiouContent fromXml(String xml) {
		QNameMap qmap = new QNameMap();
		qmap.setDefaultNamespace("http://www.99bill.com/mas_cnp_merchant_interface");
		qmap.setDefaultPrefix("");
		StaxDriver staxDriver = new StaxDriver(qmap);
		XStream xstream = new XStream(staxDriver);
		xstream.autodetectAnnotations(true);
		xstream.ignoreUnknownElements();
		xstream.alias("RESPONSE", QueryOrderByOrderNumFuiouContent.class);
		return (QueryOrderByOrderNumFuiouContent) xstream.fromXML(xml);
	}
}
